<template>
  <div>
    <el-upload
        class="upload-demo"
        action="http://localhost:8000/carservice/CarFile/upload"
        multiple
        :limit="3">
      <el-button size="small" type="primary">点击上传</el-button>
    </el-upload>
    <el-button  icon="el-icon-star-off" type="warning" plain @click="download">导出</el-button>
    <el-table
        :data="tableData"
        border
        style="width: 100%">
      <el-table-column
          fixed
          prop="fileId"
          label="文件ID"
          width="150">
      </el-table-column>
      <el-table-column
          prop="fileName"
          label="图片"
          width="300">
        <template v-slot="s">
          <img :src="s.row.fileName" alt="" style="width: 100px;height: 100px">
        </template>
      </el-table-column>
      <el-table-column
          prop="carId"
          label="车辆id"
          width="120">
      </el-table-column>
      <el-table-column
          fixed="right"
          label="操作"
          width="100">
        <template slot-scope="scope">
          <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
          <el-button type="text" size="small">编辑</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: "ListView",
  data() {
    return {
      tableData:[],
    }
  }, methods: {
    download(){
      location.href="http://localhost:8000/carservice/CarFile/download";
    },
    list(){
       this.axios.post("http://localhost:9033/CarFile/list").then(res=>{
          this.tableData=res.data.data;
       })
    },
  }, created() {
       this.list();
  }
}
</script>

<style scoped>

</style>